package com.quanxiaoha.xiaohashu.user.biz.rpc;


import com.quanxiaoha.xiaohashu.distributed.api.DistributedIdGeneratorFeignApi;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * @Author: jingyan_liu
 * @CreateTime: 2025-07-27
 * @Description:
 * @Version: 1.0
 */


@Component
public class DistributedIdGeneratorRpcService {
	
	/**
	 * Leaf 号段模式：小哈书 ID 业务标识
	 */
	private static final String BIZ_TAG_XIAOHASHU_ID = "leaf-segment-xiaohashu-id";
	
	/**
	 * Leaf 号段模式：用户 ID 业务标识
	 */
	private static final String BIZ_TAG_USER_ID = "leaf-segment-user-id";
	
	@Resource
	private DistributedIdGeneratorFeignApi distributedIdGeneratorFeignApi;
	
	/**
	 * 调用分布式 ID 生成服务生成小哈书 ID
	 *
	 * @return
	 */
	public String getXiaohashuId() {
		return distributedIdGeneratorFeignApi.getSegmentId(BIZ_TAG_XIAOHASHU_ID);
	}
	
	/**
	 * 调用分布式 ID 生成服务用户 ID
	 *
	 * @return
	 */
	public String getUserId() {
		return distributedIdGeneratorFeignApi.getSegmentId(BIZ_TAG_USER_ID);
	}
}
